from io import BytesIO

# from io import StringIO
#
# str_io = StringIO("hello world")
# print(str_io.readline())
# str_io.close()


# from io import StringIO
#
# str_io = StringIO()
# str_io.write("hello")
# str_io.write(" world")
# print(str_io.getvalue())
# str_io.close()


# from io import StringIO
#
# with StringIO() as str_io:
#     str_io.write("hello")
#     str_io.write(" world")
#     print(str_io.getvalue())
#
# print(str_io.closed)

bytes_io = BytesIO()
bytes_io.write("hello".encode("utf-8"))
bytes_io.write("world".encode("utf-8"))
print(bytes_io.getvalue())
